Convert to content type where needed.
Should fix various issues on Windows and OS X.
https://bugzilla.gnome.org/show_bug.cgi?id=734946
if ((filter_info->contains & rule->needed) != rule->needed)
continue;
-
+
switch (rule->type)
{
case FILTER_RULE_MIME_TYPE:
- if (filter_info->mime_type != NULL &&
- g_content_type_is_a (filter_info->mime_type, rule->u.mime_type))
- return TRUE;
+ if (filter_info->mime_type != NULL)
+ {
+ gchar *filter_content_type, *rule_content_type;
+ gboolean match;
+
+ filter_content_type = g_content_type_from_mime_type (filter_info->mime_type);
+ rule_content_type = g_content_type_from_mime_type (rule->u.mime_type);
+ match = g_content_type_is_a (filter_content_type, rule_content_type);
+ g_free (filter_content_type);
+ g_free (rule_content_type);
+
+ if (match)
+ return TRUE;
+ }
break;
case FILTER_RULE_PATTERN:
if (filter_info->display_name != NULL &&
switch (rule->type)
{
case FILTER_RULE_MIME_TYPE:
- if (filter_info->mime_type != NULL &&
- g_content_type_is_a (filter_info->mime_type, rule->u.mime_type))
- return TRUE;
+ if (filter_info->mime_type != NULL)
+ {
+ gchar *filter_content_type, *rule_content_type;
+ gboolean match;
+
+ filter_content_type = g_content_type_from_mime_type (filter_info->mime_type);
+ rule_content_type = g_content_type_from_mime_type (rule->u.mime_type);
+ match = g_content_type_is_a (filter_content_type, rule_content_type);
+ g_free (filter_content_type);
+ g_free (rule_content_type);
+
+ if (match)
+ return TRUE;
+ }
break;
case FILTER_RULE_APPLICATION:
if (filter_info->applications)
GtkRecentManager *manager = user_data;
GtkRecentData recent_data;
GFileInfo *file_info;
- gchar *uri, *basename;
+ gchar *uri, *basename, *content_type;
uri = g_file_get_uri (file);
else
{
basename = g_file_get_basename (file);
- recent_data.mime_type = g_content_type_guess (basename, NULL, 0, NULL);
+ content_type = g_content_type_guess (basename, NULL, 0, NULL);
+ recent_data.mime_type = g_content_type_get_mime_type (content_type);
g_free (basename);
+ g_free (content_type);
}
recent_data.app_name = g_strdup (g_get_application_name ());
else
{
gchar *text;
+ gchar *content_image;
+ gchar *content_text;
+
+ content_image = g_content_type_from_mime_type ("image/*");
+ content_text = g_content_type_from_mime_type ("text/*");
data = g_bytes_get_data (bytes, &size);
type = g_content_type_guess (name, data, size, NULL);
gtk_label_set_text (GTK_LABEL (rl->priv->size_label), text);
g_free (text);
- if (g_content_type_is_a (type, "text/*"))
+ if (g_content_type_is_a (type, content_text))
{
gtk_text_buffer_set_text (rl->priv->buffer, data, -1);
gtk_stack_set_visible_child_name (GTK_STACK (rl->priv->content), "text");
}
- else if (g_content_type_is_a (type, "image/*"))
+ else if (g_content_type_is_a (type, content_image))
{
gtk_image_set_from_resource (GTK_IMAGE (rl->priv->image), path);
gtk_stack_set_visible_child_name (GTK_STACK (rl->priv->content), "image");
g_free (type);
g_bytes_unref (bytes);
+
+ g_free (content_image);
+ g_free (content_text);
}
g_free (path);